#-------------------------------------------------
#
# Project created by QtCreator 2012-05-16T21:17:18
#
#-------------------------------------------------

QT       += core gui opengl
QT *= xml opengl

TARGET = MyBullet
TEMPLATE = app

DESTDIR = bin
UI_DIR = .

CONFIG(debug, debug|release) {
        TARGET = MyBullet
        OBJECTS_DIR = debug
        MOC_DIR = debug/moc
        UI_DIR = src/Gui
}

CONFIG(release, debug|release) {
        TARGET = MyBullet
        OBJECTS_DIR = release
        MOC_DIR = release/moc
        UI_DIR = src/Gui
}

INCLUDEPATH += $$[QT_INSTALL_EXAMPLES]/opengl/shared
INCLUDEPATH += /Users/sara/Documents/Code/bullet-2.79/Demos/OpenGL

INCLUDEPATH += src
INCLUDEPATH += src/Math
INCLUDEPATH += src/Gui
INCLUDEPATH += src/Resources
INCLUDEPATH += src/Resources/TriMesh

SOURCES += src/main.cpp\
        src/Gui/mainwindow.cpp \
    src/display.cpp \
    src/rigidbody.cpp \
    src/scene.cpp \
    src/Bullet/bulletengine.cpp \
    src/camera.cpp \
    src/viewer.cpp \
    src/Gui/dialogaddobject.cpp \
    src/Math/vector3.cpp \
    src/Math/quaternion.cpp \
    src/Math/aabb.cpp \
    src/Math/angleaxis.cpp \
    src/Bullet/bulletrigidbody.cpp \
    src/Math/matrix33.cpp \
    src/Resources/TriMesh/Writer.cpp \
    src/Resources/TriMesh/TriVertex.cpp \
    src/Resources/TriMesh/TriMesh.cpp \
    src/Resources/TriMesh/TriFace.cpp \
    src/Resources/TriMesh/TriEdge.cpp \
    src/Resources/TriMesh/TriCirculator.cpp \
    src/Resources/TriMesh/Reader.cpp \
    src/Math/vector2.cpp \
    src/Resources/resourcemanager.cpp \
    src/Bullet/bulletcollisionalgorithm.cpp \
    src/CollisionDetection/spherespherealgorithm.cpp

HEADERS  += src/Gui/mainwindow.h \
    src/Bullet/bulletengine.h \
    src/rigidbody.h \
    src/Math/typedefs.h \
    src/scene.h \
    src/rigidbodyengine.h \
    src/display.h \
    src/camera.h \
    src/viewer.h \
    src/Gui/dialogaddobject.h \
    src/Math/vector3.h \
    src/Math/quaternion.h \
    src/Math/aabb.h \
    src/Math/angleaxis.h \
    src/Bullet/bulletrigidbody.h \
    src/Math/matrix33.h \
    src/Resources/TriMesh/TriWriter.h \
    src/Resources/TriMesh/TriVertex.h \
    src/Resources/TriMesh/TriReader.h \
    src/Resources/TriMesh/TriMesh.h \
    src/Resources/TriMesh/TriFace.h \
    src/Resources/TriMesh/TriEdge.h \
    src/Resources/TriMesh/TriCirculator.h \
    src/Math/vector2.h \
    src/Resources/resourcemanager.h \
    src/Bullet/bulletcollisionalgorithm.h \
    src/CollisionDetection/spherespherealgorithm.h


RESOURCES += Icons.qrc


FORMS    += src/Gui/mainwindow.ui \
    src/Gui/dialogaddobject.ui

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../../Library/Frameworks/release/ -lBulletDynamics
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../../Library/Frameworks/debug/ -lBulletDynamics
else:mac: LIBS += -F$$PWD/../../../../../../Library/Frameworks/ -framework BulletDynamics
else:symbian: LIBS += -lBulletDynamics
else:unix: LIBS += -L$$PWD/../../../../../../Library/Frameworks/ -lBulletDynamics

INCLUDEPATH += $$PWD/../../../../../../Library/Frameworks/BulletDynamics.framework/Versions/2.79/Headers
DEPENDPATH += $$PWD/../../../../../../Library/Frameworks/BulletDynamics.framework/Versions/2.79/Headers

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../../Library/Frameworks/release/ -lBulletCollision
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../../Library/Frameworks/debug/ -lBulletCollision
else:mac: LIBS += -F$$PWD/../../../../../../Library/Frameworks/ -framework BulletCollision
else:symbian: LIBS += -lBulletCollision
else:unix: LIBS += -L$$PWD/../../../../../../Library/Frameworks/ -lBulletCollision

INCLUDEPATH += $$PWD/../../../../../../Library/Frameworks/BulletCollision.framework/Versions/2.79/Headers
DEPENDPATH += $$PWD/../../../../../../Library/Frameworks/BulletCollision.framework/Versions/2.79/Headers

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../../Library/Frameworks/release/ -lLinearMath
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../../Library/Frameworks/debug/ -lLinearMath
else:mac: LIBS += -F$$PWD/../../../../../../Library/Frameworks/ -framework LinearMath
else:symbian: LIBS += -lLinearMath
else:unix: LIBS += -L$$PWD/../../../../../../Library/Frameworks/ -lLinearMath

INCLUDEPATH += $$PWD/../../../../../../Library/Frameworks/LinearMath.framework/Versions/2.79/Headers
DEPENDPATH += $$PWD/../../../../../../Library/Frameworks/LinearMath.framework/Versions/2.79/Headers

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../bullet-2.79/bin/Demos/OpenGL/Debug/release/ -lOpenGLSupport
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../bullet-2.79/bin/Demos/OpenGL/Debug/debug/ -lOpenGLSupport
else:symbian: LIBS += -lOpenGLSupport
else:unix: LIBS += -L$$PWD/../../bullet-2.79/bin/Demos/OpenGL/Debug/ -lOpenGLSupport

INCLUDEPATH += $$PWD/../../bullet-2.79/Demos/OpenGL
DEPENDPATH += $$PWD/../../bullet-2.79/Demos/OpenGL

win32:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../../bullet-2.79/bin/Demos/OpenGL/Debug/release/OpenGLSupport.lib
else:win32:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../bullet-2.79/bin/Demos/OpenGL/Debug/debug/OpenGLSupport.lib
else:unix:!symbian: PRE_TARGETDEPS += $$PWD/../../bullet-2.79/bin/Demos/OpenGL/Debug/libOpenGLSupport.a

mac: LIBS += -framework GLUT
else:unix|win32: LIBS += -lGLUT

INCLUDEPATH += ../../eigen-eigen-599fc4f7c736

#Here starts QGLViewer
  isEmpty( PREFIX ) {
    # Try same INCLUDE_DIR and LIB_DIR parameters than for the make install.
    PREFIX=/usr
  }

  # LIB_NAME
  LIB_NAME = libQGLViewer*.so*
  macx|darwin-g++ {
    LIB_NAME = libQGLViewer.$${QMAKE_EXTENSION_SHLIB}
  }
  hpux {
    LIB_NAME = libQGLViewer*.sl*
  }

  !isEmpty( QGLVIEWER_STATIC ) {
    LIB_NAME = libQGLViewer*.a
  }

  # LIB_DIR
  isEmpty( LIB_DIR ) {
    LIB_DIR = $${PREFIX}/lib
  }

  !exists( $${LIB_DIR}/$${LIB_NAME} ) {
    exists( ../../QGLViewer/$${LIB_NAME} ) {
      #message( The library was found in ../../QGLViewer which will be set as the LIB_DIR )
      LIB_DIR = ../../QGLViewer
    }
  }

  !exists( $${LIB_DIR}/$${LIB_NAME} ) {
    exists( ../../QGLViewer-build-desktop/$${LIB_NAME} ) {
      #message( The library was found in ../../QGLViewer-build-desktop which will be set as the LIB_DIR )
      LIB_DIR = ../../QGLViewer-build-desktop
    }
  }

  macx|darwin-g++ {
    !exists( $${LIB_DIR}/$${LIB_NAME} ) {
      # DYLIB was not found, try to find Framework instead
      LIB_NAME = QGLViewer.framework/QGLViewer
      LIB_DIR = ~/Library/Frameworks
      # qmake does not handle tilde
      LIB_DIR = $$system(cd $${LIB_DIR};pwd)

      !exists( $${LIB_DIR}/$${LIB_NAME} ) {
        exists( ../../QGLViewer/$${LIB_NAME} ) {
          #message( The framework was found in ../../QGLViewer which will be set as the LIB_DIR )
          LIB_DIR = ../../QGLViewer
        }
      }

      !exists( $${LIB_DIR}/$${LIB_NAME} ) {
        exists( ../../QGLViewer-build-desktop/$${LIB_NAME} ) {
          #message( The framework was found in ../../QGLViewer-build-desktop which will be set as the LIB_DIR )
          LIB_DIR = ../../QGLViewer-build-desktop
        }
      }
    }
  }

  !exists( $${LIB_DIR}/$${LIB_NAME} ) {
    message( Unable to find $${LIB_NAME} in $${LIB_DIR}. Make sure you have built it. )
    message( You should run qmake LIB_DIR=/path/to/QGLViewer/$${LIB_NAME} )
  }

  # The actual directory where the library/framework was found
  LIB_DIR_ABSOLUTE_PATH = $$system(cd $${LIB_DIR};pwd)

  # INCLUDE_DIR
  isEmpty( INCLUDE_DIR ) {
    INCLUDE_DIR = $${PREFIX}/include
  }

  macx|darwin-g++ {
          !exists( $${INCLUDE_DIR}/QGLViewer/qglviewer.h ) {
          INCLUDE_DIR=$${LIB_DIR}/QGLViewer.framework
              exists( $${LIB_DIR}/QGLViewer.framework/Headers/QGLViewer/qglviewer.h ) {
                 INCLUDE_DIR = $${LIB_DIR}/QGLViewer.framework/Headers
              }
          }
  }

  !exists( $${INCLUDE_DIR}/QGLViewer/qglviewer.h ) {
    exists( ../../QGLViewer/qglviewer.h ) {
      # message( libQGLViewer header files were not installed in standard $${INCLUDE_DIR} directory )
      # message( Headers were found in ../.. which will be set as the INCLUDE_DIR )
      INCLUDE_DIR = ../..
    }
  }

  !exists( $${INCLUDE_DIR}/QGLViewer/qglviewer.h ) {
    message( Unable to find QGLViewer/qglviewer.h in $${INCLUDE_DIR} )
    error( Use qmake INCLUDE_DIR=/path/to/QGLViewerDir )
  }


  macx|darwin-g++ {
    # On Mac, the lib path can be specified in the executable using install_name_tool
    contains( LIB_NAME, ".*QGLViewer.framework.*" ) {
      # If framework was not found in a standard directory
      !contains( LIB_DIR, ".*/Library/Frameworks/*$" ) {
        QMAKE_LFLAGS += -F$${LIB_DIR}
        !plugin:QMAKE_POST_LINK=install_name_tool -change QGLViewer.framework/Versions/2/QGLViewer $${LIB_DIR_ABSOLUTE_PATH}/QGLViewer.framework/Versions/2/QGLViewer $${TARGET}.app/Contents/MacOS/$${TARGET}
      }
      LIBS += -F$${LIB_DIR} -framework QGLViewer
    } else {
        !plugin:QMAKE_POST_LINK=install_name_tool -change libQGLViewer.2.dylib $${LIB_DIR_ABSOLUTE_PATH}/libQGLViewer.2.dylib $${TARGET}.app/Contents/MacOS/$${TARGET}
        LIBS *= -L$${LIB_DIR} -lQGLViewer
    }
  } else {
    isEmpty(QMAKE_LFLAGS_RPATH) {
      !plugin:QMAKE_LFLAGS += -Wl,-rpath,$${LIB_DIR_ABSOLUTE_PATH}
    } else {
      !plugin:QMAKE_RPATHDIR *= $${LIB_DIR_ABSOLUTE_PATH}
    }
    LIBS *= -L$${LIB_DIR} -lQGLViewer

        # Qt 4.8 removed the GLU dependency
    QMAKE_LIBS_OPENGL *= -lGLU
  }

  # Paths were correctly detected
  INCLUDEPATH *= $${INCLUDE_DIR}
  DEPENDPATH  *= $${INCLUDE_DIR}

  !isEmpty( QGLVIEWER_STATIC ) {
    LIBS *= $${LIB_DIR}/$${LIB_NAME}
  }

  macx|darwin-g++ {
    !contains( QT_VERSION, "^4.*" ) {
      # Qt3 only
      LIBS *= -lobjc
      CONFIG -= thread
    }
  }

  # Remove debugging options in release mode makes files much smaller
  release:QMAKE_CFLAGS_RELEASE -= -g
  release:QMAKE_CXXFLAGS_RELEASE -= -g

  # Intermediate files are created in an hidden folder
  MOC_DIR = .moc
  OBJECTS_DIR = .obj
#Here ends QGLViewer


RESOURCES += \
    Icons.qrc
